home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freaks Macintosh Archive
/
Freaks Macintosh Archive.bin
/
Freaks Macintosh Archives
/
Network
/
TREnetLAP1.0.sit
/
TR Enet LAP 1.0 Folder
/
TR Enet LAP 1.0 Release Notes
< prev
next >
Wrap
Text File
|
1994-07-23
|
6KB
|
121 lines
Traceroute Ethernet LAP 1.0
By: Jim Browne (jbrowne@uiuc.edu)
7/23/94
I wrote this LAP while on my quest to port the Traceroute program to the Macintosh.
I 'grew up' on UNIX machines back in the mid-80's, and when I moved over to doing
TCP/IP programming on the Mac, I really missed Traceroute... so here's the first
part of it.
What does it do?:
What does this LAP do? Well, it is (I hope) an exact duplicate of Apple's default
Ethernet LAP with a few notable exceptions. First, this LAP implementes loopback
properly. (Although it still doesn't do 127.0.0.1, but that can be added if enough
people complain.) Second, this LAP installs a Gestalt selector that allows application
programs to perform Raw IP writes and filter all incoming IP packets.
The Gestalt selector:
The Gestalt selector (JMBe), returns a pointer to the following structure (defined in
RawIP.h):
typedef struct {
short version; // Version of interface
short availFlags; // What is available
RawWriteProcPtr RawIPWrite; // Raw IP Write routine address
RawIPFilterProcPtr RawIPFilter; // Raw IP Filter routine address
short useFilter; // Non-zero if filter routine is to be called
Ptr user1; // Passed to Filter routine
Ptr user2; // Passed to Filter routine
ProcPtr reserved1;
long reserved2[10];
} RawIPGestaltStruct;
version is the current version of the LAP, in this case 1.
availFlags lists what features are available in the LAP. The two currently defined
flags are kHaveRIPFilter and kHaveRIPWrite. I did this so I can distribute a version
of the LAP source code that does not have IP filtering in it (more on this later).
RawIPWrite is the address of the routine to call inside the LAP to perform a raw IP write.
RawIPFilter is a location for you to stick the address of your RawIP filter routine.
useFilter tells the LAP whether or not it should call the RawIP filter routine.
user1 and user2 are two fields that are passed to the RawIP filter routine you install,
use them as you see fit.
How send Raw IP packets:
To send a RawIP packet onto the network, allocate a RawWriteParam structure. Stick your
A5 value in the userA5 field. Fill out the wdsEntry to point to your IP packet in
memory. (Be sure to set the length field!). Finally, you can place the address of
a completion routine in the iop.ioCompletion field. Then just call the RawWriteIP
function, using the calling conventions typedef'd in RawWriteProcPtr. It's that easy.
The RawIPWrite function will return an error directly, or in the iop.ioResult field of
the RawWriteParam structure.
Those of you who are familliar with the low level routines in MacTCP may recognize the
RawWriteParam structure as something else in disguise. Don't let your knowledge fool you!
DO NOT try to use any of the reserved fields in the RawWriteParam structure, it won't
neccessarily do what you would expect.
How to filter incoming IP packets:
Create a filter function in your application. The filter function should be of the form
typedef'd as RawIPFilterProcPtr. The filter function should return true if the LAP should
pass the IP packet onto MacTCP, otherwise the packet will be discarded and MacTCP will
never see it. The IPdata field points to the incoming IP packet, and the length field
gives you its length. You may modify the packet data if you wish. However, changing
the length of the packet will not work. The filter function will only be called if the
useFilter field in the Gestalt structure is non-zero. Install your filter _before_ setting
the userFilter field to a non-zero value. Setting the useFilter field to zero will disable
packet filtering. I reccomend your application patch ExitToShell to zero the useFilter
field, just in case.
So where's Traceroute?:
An alpha of traceroute is done. I'm not at all happy with the interface. I may work on
it some soon, or I may release it as is, or I may give the code to PeterL so he can do
the interface. I don't know right now. The important thing is I am releasing this LAP.
Now anyone can write traceroute for an Ethernet connected Macintosh.
What about source code?:
I can give out the source code to 90% of the LAP. The code in there that lets me do
IP packet filtering, however, is proprietary code owned by someone who shall remain
anonymous. I'd very much like to that that person for letting me use that little bit
of code. I can, however, distribute a copy of the source code of the LAP that does not
do IP packet filtering. Currently I do not have an archive of the non-filtering code
ready, but if you send me some email I will get you a copy.
Small print:
There is no warranty on this software whatsoever. It has worked without problems for me
for quite some time. However, if it crashes your machine or causes you to lose data, I
cannot be held responsible. I am trying to make it flawless, but I can't state that it
is 100% reliable.
Conclusion:
I've had the TR Ethernet LAP running on my PowerMacintosh 8100/80 for two months now. I've
had no problems with it. This does not, of course, guarantee that it is bug free. Please
report any bugs you find to me. I'm very open to suggestions. I decided at the
beginning to make this interface open so other people could use it. I figure if people
have to run a separate LAP to get this functionality, they don't want to have to swtich
between N different LAPs for N different packet filtering applications.
If you would like to modify your SLIP or PPP lap to support this interface, please let me
know and I will give you any help I possibly can. I'd like my traceroute program to work
over SLIP and PPP.
Enjoy the LAP, and WRITE FREE SOFTWARE for it. ;)
Jim Browne
jbrowne@uiuc.edu
(Occasionally "Zep" on IRC)
PS: You see, Klaus, I really do release my code... eventually!